import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 分佣配置信息 */
export interface BrokerageRole {
          id: number; // 主键(自增策略)
          brokeragePercent?: number; // 返佣百分比
          roleName?: string; // 分佣角色名称
  }

// 分佣配置 API
export const BrokerageRoleApi = {
  // 查询分佣配置分页
  getBrokerageRolePage: async (params: any) => {
    return await request.get({ url: `/system/brokerage-role/page`, params })
  },

  // 查询分佣配置详情
  getBrokerageRole: async (id: number) => {
    return await request.get({ url: `/system/brokerage-role/get?id=` + id })
  },

  // 新增分佣配置
  createBrokerageRole: async (data: BrokerageRole) => {
    return await request.post({ url: `/system/brokerage-role/create`, data })
  },

  // 修改分佣配置
  updateBrokerageRole: async (data: BrokerageRole) => {
    return await request.put({ url: `/system/brokerage-role/update`, data })
  },

  // 删除分佣配置
  deleteBrokerageRole: async (id: number) => {
    return await request.delete({ url: `/system/brokerage-role/delete?id=` + id })
  },

  /** 批量删除分佣配置 */
  deleteBrokerageRoleList: async (ids: number[]) => {
    return await request.delete({ url: `/system/brokerage-role/delete-list?ids=${ids.join(',')}` })
  },

  // 导出分佣配置 Excel
  exportBrokerageRole: async (params) => {
    return await request.download({ url: `/system/brokerage-role/export-excel`, params })
  }
}